[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  Function            getreal - inputs a real from the keyboard

  Syntax              char *getreal(int size, int decimal);

  Prototype in        keyboard.h

  Remarks             getreal inputs a real (double) from the keyboard.
                      Only digits, decimal place, leading sign and
                      backspace are valid input. Input is terminated when
                      the ENTER key is pressed.

                      the maximum length of input is size and the maximum
                      number of decimal places is decimal. When
                      calculating size, you must leave enough room for
                      decimal, plus the number of places of the leading
                      integer, one for the decimal point and one for the
                      leading sign.

                      Video output is via Borland's console i/o.

  Return value        returns a string of the format  [sn] [ddd] [.]
                      [ddd] where

                           [sn]  = optional sign (+ or -)
                           [ddd] = optional digits
                           [.]   = optional decimal point

  See also            getdouble(), getint()

  Example             #include <keyboard.h>
                      #include <stdio.h>
                      main()
                      {
                           char *c;

                           printf("Give me a real: ");
                           c = getreal(8,2);
                           printf("Your input is %s\n",c);
                      }

  Program output      Give me a real: -1012.30
                      Your input is -1012.30


See Also: getdouble() getget() getint()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson